package case1.controller;

import case1.model.BeatModelInterface;
import case1.view.DJView;

/**
 * description:
 *
 * @author Yuanml on 2020/11/11 10:23
 */
public class BeatController implements ControllerInterface{
    private BeatModelInterface model;
    private DJView view;
    public BeatController(BeatModelInterface beatModelInterface) {
        this.model = beatModelInterface;
        view = new DJView(this, model);
        view.createView();
        view.createControls();
        view.disableStartMenuItem();
        view.disableStopMenuItem();
        model.initialize();
    }


    @Override
    public void start() {
        model.on();
        view.disableStartMenuItem();
        view.enableStopMenuItem();
    }

    @Override
    public void stop() {
        model.off();
        view.disableStartMenuItem();
        view.disableStopMenuItem();
    }

    @Override
    public void increaseBPM() {
        model.setBPM(model.getBPM() + 1);
    }

    @Override
    public void decreaseBPM() {
        model.setBPM(model.getBPM() - 1);
    }

    @Override
    public void setBPM(int bpm) {
        model.setBPM(bpm);
    }
}
